package switchStream;

import java.io.*;

public class t1 {
    public static void main(String[] args) throws IOException {
        //                                                                                      不清空原有数据，进行情况。   对数据进行编码
        OutputStreamWriter osw =   new OutputStreamWriter(new FileOutputStream("path",true),"gbk"); // 不写格式，默认utf8
        osw.write("呼,1呼2呼");
        osw.close();
    }

    private static void read() throws IOException {
        InputStreamReader isr =  new InputStreamReader(new FileInputStream("D:\\study\\999.java拓展\\自己敲代码-git\\javaBase\\homeExtendDay14\\src\\main\\java\\switchStream\\a-gbk.txt"),"gbk");
        int i = 0;
        while ((i = isr.read()) !=-1){
            System.out.println((char)i);
        }
    }
}
